package com.domain.common;


/**
 * 对象返回类
 *
 * @author dapeng
 */
public class Result {
    private Integer code;
    private String desc;
    private Object data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Result(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, String desc, Object data) {
        this.code = code;
        this.desc = desc;
        this.data = data;
    }

    public static Result success() {
        return new Result(Comments.SUCCESS, "ok");
    }

    public static Result success(String desc, Object date) {
        return new Result(Comments.SUCCESS, desc, date);
    }


    public static Result success(Object data) {
        return new Result(Comments.SUCCESS, data);
    }


    public static Result fail(String desc) {
        return new Result(Comments.FAIL, desc);
    }

    public static Result fail(Object data) {
        return new Result(Comments.FAIL, data);
    }

    public static Result publicResult(Integer code, String desc) {
        return new Result(code, desc);
    }

    public static Result publicResult(Integer code, String desc, Object data) {
        return new Result(code, desc, data);
    }
}
